package com.wetao.testkotlin

class TestClient(val name:String, val postalCode:Int) {

    override fun toString(): String = "Client(name=$name, postalCode=$postalCode)"

    //==和equals 表示值相等； ===引用相等
    override fun equals(other: Any?): Boolean {
        if (other == null || other !is TestClient)
            return false
        return name == other.name && postalCode == other.postalCode
    }

    //set list里面是否包含，先比较hashcode是否相等，在比较equals是否相等
    override fun hashCode(): Int = name.hashCode() * 31 + postalCode
}

